package com.scsj.supermarket.view.activity.shopermodel;

import android.os.Bundle;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;

import com.scsj.supermarket.R;
import com.scsj.supermarket.adapter.ApplicationRecordAdapter;
import com.scsj.supermarket.bean.CommAlreadyBean;
import com.scsj.supermarket.view.fragment.basemodel.BaseFragment;

import java.util.ArrayList;
import java.util.List;

/**
 *
 * 审核记录
 */

public class ApplicationRecordFragment extends BaseFragment {

    private int index;
    private RecyclerView dataListRv;
    private List<CommAlreadyBean> commAlreadyBeans;
    private ApplicationRecordAdapter applicationRecordAdapter;
    private SwipeRefreshLayout swipeRefreshLayout;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_arecord_lauout, null);
        initView(view, null);
        initData();
        return view;
    }
    public ApplicationRecordFragment() {

    }

    @Override
    protected void initView(View view, Bundle savedInstanceState) {

        dataListRv= view.findViewById(R.id.application_list_rv);
        dataListRv.setLayoutManager(new LinearLayoutManager(getActivity()));
        dataListRv.setNestedScrollingEnabled(false);
        swipeRefreshLayout= view.findViewById(R.id.refresh_view);
        // 设置下拉进度的背景颜色，默认就是白色的
        swipeRefreshLayout.setProgressBackgroundColorSchemeResource(android.R.color.white);
        // 设置下拉进度的主题颜色
        swipeRefreshLayout.setColorSchemeResources(R.color.colorAccent, R.color.colorPrimary, R.color.colorPrimaryDark);

        swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
            @Override
            public void onRefresh() {
                Toast.makeText(getActivity(), "刷新了一条数据", Toast.LENGTH_SHORT).show();
            }
        });
    }
    @Override
    protected void initListener() {
    }

    @Override
    protected void initData() {
        commAlreadyBeans = new ArrayList<>();
        commAlreadyBeans.add(new CommAlreadyBean(R.mipmap.zzz_clothing,"交路口附近阿拉山口放假啊李开复阿萨冷风机","获得254积分"));
        commAlreadyBeans.add(new CommAlreadyBean(R.mipmap.zzz_clothing,"交路口附近阿拉山口放假啊李开复阿萨冷风机","获得254积分"));
        commAlreadyBeans.add(new CommAlreadyBean(R.mipmap.zzz_clothing,"交路口附近阿拉山口放假啊李开复阿萨冷风机","获得254积分"));
        commAlreadyBeans.add(new CommAlreadyBean(R.mipmap.zzz_clothing,"交路口附近阿拉山口放假啊李开复阿萨冷风机","获得254积分"));
        commAlreadyBeans.add(new CommAlreadyBean(R.mipmap.zzz_clothing,"交路口附近阿拉山口放假啊李开复阿萨冷风机","获得254积分"));
        commAlreadyBeans.add(new CommAlreadyBean(R.mipmap.zzz_clothing,"交路口附近阿拉山口放假啊李开复阿萨冷风机","获得254积分"));
        commAlreadyBeans.add(new CommAlreadyBean(R.mipmap.zzz_clothing,"交路口附近阿拉山口放假啊李开复阿萨冷风机","获得254积分"));
        commAlreadyBeans.add(new CommAlreadyBean(R.mipmap.zzz_clothing,"交路口附近阿拉山口放假啊李开复阿萨冷风机","获得254积分"));

        applicationRecordAdapter = new ApplicationRecordAdapter(commAlreadyBeans);
        dataListRv.setAdapter(applicationRecordAdapter);
    }

    @Override
    protected int getLayoutId() {
        return 0;
    }
}
